#ifndef CANVASS_H
#define CANVASS_H
#include<QGraphicsView>
#include<QGraphicsEllipseItem>
#include<QGraphicsLineItem>
#include<QGraphicsScene>
#include<QPen>
#include<QGraphicsRectItem>
#include<QMouseEvent>
#include<QGraphicsSceneMouseEvent>
#include<QVector>
#include<QQueue>
#include<QDebug>
#include<QGraphicsItemGroup>
#include<QString>
#include<QGraphicsSimpleTextItem>
#include<QFont>
#include<QPushButton>
#include<QLineEdit>
#include<string>
#include<QGraphicsItemGroup>
using namespace std;
class canvass
{
public:
    canvass();
};
class myQGEI : public QGraphicsEllipseItem,public QObject
{
   public:
   void mousePressEvent();
   myQGEI(qreal a, qreal b, qreal c, qreal d): QGraphicsEllipseItem(a, b , c, d ){x=a+5;y=b+5;};
   private:
   int x;
   int y;
   QPen pen;

};
class myQGLI : public QGraphicsLineItem
{
public :myQGLI(qreal x1,qreal y1, qreal x2, qreal y2):QGraphicsLineItem(x1,x2,y1,y2){};
    int num;
private:

};
class myQGS : public QGraphicsScene
{
public:
    myQGS():QGraphicsScene(){};

    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
    void setPen();
    void addPoint(QGraphicsSceneMouseEvent *e);
    void addLine(QString a,QString b);
    void Dijistra(int u);

private:
    static const int N=100;
    static const int INF=10000;
    int map[N][N],dist[N],P[N],n,m;
    bool flag[N];
    QPen linePen;
    QPen circlePen;
    QVector<int> aa;
    QGraphicsItemGroup *oItemGroup;
};
class MGraph{
public:
    MGraph();
    ~MGraph();
    void Dijistra(int v);
    int Min(double a[],int vertexNum);
    double dist[100];
        vector<int> a[54];
static const int MaxSize = 100;
double edge[MaxSize][MaxSize];
        QString path[54];
private:

    int vertex[MaxSize];

    int vertexNum,edgeNum;

};

class myQGV :public QGraphicsView
{
public:
    myQGV();
    int a1;
    int b1;
 MGraph *aaa=new MGraph();
    QPen linePen;
    QPen circlePen;
QFont font;
    QPen pen[3];
    void CreateRoute();
    QString ss1,ss2;
    void LinkLine();
    QLineEdit *edit1=new QLineEdit;
    QLineEdit *edit2=new QLineEdit;
    QLineEdit *edit3=new QLineEdit;
    QLineEdit *edit4=new QLineEdit;

    MGraph *m1=new MGraph();
    QGraphicsItemGroup *qig=new QGraphicsItemGroup;
    myQGLI *mlin[54];
    QString olda,oldb;

private:
  myQGS *scene=new myQGS();
  int tot1[54],tot2[54];
signals:
 private slots:void addLine(QString a,QString b);
};


#endif // CANVASS_H
